package www.bawei.springboot.util;

public class jsonUtils {

	private String code;
	private Object data;
	private String msg;
	
	private transient final static String SUCCESS_CODE = "200";
	private transient final static String ERROR_CODE = "400";

	private jsonUtils() {

	}

	public static jsonUtils success(Object obj) {
		return new jsonUtils().setCode(SUCCESS_CODE).setData(obj);
	}
	
	public static jsonUtils success() {
		return new jsonUtils().setCode(SUCCESS_CODE);
	}
	public static jsonUtils error(String msg) {
		return new jsonUtils().setMsg(msg).setCode(ERROR_CODE);
	}
	public String getCode() {
		return code;
	}

	public jsonUtils setCode(String code) {
		this.code = code;
		return this;
	}

	public Object getData() {
		return data;
	}

	public jsonUtils setData(Object data) {
		this.data = data;
		return this;
	}

	public String getMsg() {
		return msg;
	}

	public jsonUtils setMsg(String msg) {
		this.msg = msg;
		return this;
	}

}
